#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include "uthash.h"

#include <iso646.h>

int* grayCode(int n, int* returnSize);

int main()
{
	return 0;
}

/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
int* grayCode(int n, int* returnSize)
{
	int* res = (int*)malloc(n * sizeof n);
	*returnSize = n;

	for (int i = 0, size = 1 << n; i < size; i++)
		res[i] = i ^ i >> 1;
	return res;
}
